/**********************************************************************
* <pre>
* FILE : OrderCommandQuery.java
* CLASS : OrderCommandQuery
* AUTHOR : 
* FUNCTION : 订单发运
*======================================================================
* CHANGE HISTORY LOG
*----------------------------------------------------------------------
* MOD. NO.|   DATE   |    NAME    | REASON  |  CHANGE REQ.
*----------------------------------------------------------------------
*         |2010-05-25|            | Created |
* DESCRIPTION:
* </pre>
***********************************************************************/
package com.infodms.dms.actions.sales.ordermanage.delivery;

import java.io.OutputStream;
import java.math.BigDecimal;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

import org.apache.log4j.Logger;

import com.infodms.dms.bean.AclUserBean;
import com.infodms.dms.common.Constant;
import com.infodms.dms.common.ErrorCodeConstant;
import com.infodms.dms.common.getCompanyId.GetOemcompanyId;
import com.infodms.dms.common.materialManager.MaterialGroupManagerDao;
import com.infodms.dms.dao.sales.financemanage.AccountBalanceDetailDao;
import com.infodms.dms.dao.sales.ordermanage.delivery.OrderDeliveryDao;
import com.infodms.dms.dao.sales.ordermanage.orderquery.OrderQueryDao;
import com.infodms.dms.dao.sales.ordermanage.orderreport.OrderReportDao;
import com.infodms.dms.exception.BizException;
import com.infodms.dms.po.TmBusinessAreaPO;
import com.infodms.dms.po.TmDateSetPO;
import com.infodms.dms.po.TmOrgPO;
import com.infodms.dms.po.TtVsDlvryPO;
import com.infodms.dms.util.CommonUtils;
import com.infodms.dms.util.DateTimeUtil;
import com.infodms.dms.util.csv.CsvWriterUtil;
import com.infoservice.mvc.context.ActionContext;
import com.infoservice.mvc.context.RequestWrapper;
import com.infoservice.mvc.context.ResponseWrapper;
import com.infoservice.po3.bean.PO;
import com.infoservice.po3.bean.PageResult;

/**
 * @Title: 
 * @Description:InfoFrame3.0.V01
 * @Copyright: Copyright (c) 2010
 * @Company: www.infoservice.com.cn
 * @Date: 2010-5-25
 * @author 
 * @mail   	
 * @version 1.0
 * @remark 发运指令查询
 */
public class OrderCommandQuery {
	
	public Logger logger = Logger.getLogger(DeliveryApply.class);   
	OrderDeliveryDao dao  = OrderDeliveryDao.getInstance();
	private final AccountBalanceDetailDao accoutDao = AccountBalanceDetailDao.getInstance();
	private ActionContext act = ActionContext.getContext();
	RequestWrapper request = act.getRequest();
	ResponseWrapper response = act.getResponse();
	private final OrderReportDao reportDao = OrderReportDao.getInstance();
	private final String initUrl = "/jsp/sales/ordermanage/delivery/orderCommandQuery.jsp";
	private final String dealerInitUrl = "/jsp/sales/ordermanage/delivery/dealerOrderCommandQuery.jsp";
	private final String lowDlrInitUrl = "/jsp/sales/ordermanage/delivery/lowDlrOrderCommandQuery.jsp";
	private final String qinfoUrl = "/jsp/sales/ordermanage/delivery/orderQueryInfo.jsp";
	private final String lowQinfoUrl = "/jsp/sales/ordermanage/delivery/lowOrderQueryInfo.jsp";
	private final String printUrl = "/jsp/sales/ordermanage/delivery/orderQueryPrintInfo.jsp";
	private final String printInitUrl = "/jsp/sales/ordermanage/delivery/orderPrintList.jsp";
	private final String printNewUrl = "/jsp/sales/ordermanage/delivery/orderPrintPreview.jsp";
	private final String passageUrl = "/jsp/sales/ordermanage/delivery/passageQuery.jsp";
	private final String showSendCarsDetail = "/jsp/sales/ordermanage/delivery/showSendCarsDetail.jsp";
	private final String dealerPassageUrl = "/jsp/sales/ordermanage/delivery/dealerPassageQuery.jsp";
	private final String myreson="/jsp/sales/ordermanage/delivery/getMyReson.jsp";
	private final String myticket="/jsp/sales/ordermanage/delivery/getMyTicket.jsp";
	/**
	 * 发运指令查询页面初始化
	 */
	public void commandQueryInit(){
		AclUserBean logonUser = (AclUserBean)act.getSession().get(Constant.LOGON_USER);
		try {
			Long oemCompanyId = GetOemcompanyId.getOemCompanyId(logonUser);
			Calendar c = Calendar.getInstance();
			String year = Integer.toString(c.get(Calendar.YEAR));
			//String week = Integer.toString(c.get(Calendar.WEEK_OF_YEAR));
			List yearList = dao.getDateYearList();
			List weekList = dao.getDateWeekList();
			TmDateSetPO dateSet = reportDao.getTmDateSetPO(new java.util.Date(), oemCompanyId);
			String dateStr = DateTimeUtil.parseDateToDate(new Date());
			Long companyId = GetOemcompanyId.getOemCompanyId(logonUser);
			String areaIds = MaterialGroupManagerDao.getAreaIdsByPoseId(logonUser.getPoseId());
			act.setOutData("week", dateSet != null ? dateSet.getSetWeek() : "");
			act.setOutData("yearList", yearList);
			act.setOutData("weekList", weekList);
			act.setOutData("year", year);
			act.setOutData("dateStr", dateStr);
			List<Map<String, Object>> list_aim = dao.getWarehouseEnable_Aim(companyId, areaIds);
			List<Map<String, Object>> areaBusList=MaterialGroupManagerDao.getPoseIdBusiness(logonUser.getPoseId().toString());
			
			Long orgId = logonUser.getOrgId() ;
			String dutyType = logonUser.getDutyType() ;
			
			List<Map<String, Object>> orgList = dao.getOemOrg(dutyType, orgId) ;
			
			act.setOutData("orgList", orgList) ;
			act.setOutData("areaBusList", areaBusList);
			act.setOutData("list_aim", list_aim);
			act.setForword(initUrl);
		}catch(Exception e) {//异常方法
			BizException e1 = new BizException(act,e,ErrorCodeConstant.QUERY_FAILURE_CODE,"发运指令查询初始化");
			logger.error(logonUser,e1);
			act.setException(e1);
		}
	}
	/**
	 * 发运指令查询页面初始化
	 */
	public void dealerCommandQueryInit(){
		AclUserBean logonUser = (AclUserBean)act.getSession().get(Constant.LOGON_USER);
		try {
			Long oemCompanyId = GetOemcompanyId.getOemCompanyId(logonUser);
			Calendar c = Calendar.getInstance();
			String year = Integer.toString(c.get(Calendar.YEAR));
			//String week = Integer.toString(c.get(Calendar.WEEK_OF_YEAR));
			List yearList = dao.getDateYearList();
			List weekList = dao.getDateWeekList();
			TmDateSetPO dateSet = reportDao.getTmDateSetPO(new java.util.Date(), oemCompanyId);
			String dateStr = DateTimeUtil.parseDateToDate(new Date());
			act.setOutData("week", dateSet != null ? dateSet.getSetWeek() : "");
			act.setOutData("yearList", yearList);
			act.setOutData("weekList", weekList);
			act.setOutData("year", year);
			act.setOutData("dateStr", dateStr);
			List<Map<String, Object>> areaBusList=MaterialGroupManagerDao.getDealerBusiness(logonUser.getPoseId().toString());
			act.setOutData("areaBusList", areaBusList);
			act.setForword(dealerInitUrl);
		}catch(Exception e) {//异常方法
			BizException e1 = new BizException(act,e,ErrorCodeConstant.QUERY_FAILURE_CODE,"发运指令查询初始化");
			logger.error(logonUser,e1);
			act.setException(e1);
		}
	}
	
	/**
	 * 下级经销商发运指令查询页面初始化
	 */
	public void lowDlrCommandQueryInit(){
		AclUserBean logonUser = (AclUserBean)act.getSession().get(Constant.LOGON_USER);
		try {
			Long oemCompanyId = GetOemcompanyId.getOemCompanyId(logonUser);
			Calendar c = Calendar.getInstance();
			String year = Integer.toString(c.get(Calendar.YEAR));
			//String week = Integer.toString(c.get(Calendar.WEEK_OF_YEAR));
			List yearList = dao.getDateYearList();
			List weekList = dao.getDateWeekList();
			TmDateSetPO dateSet = reportDao.getTmDateSetPO(new java.util.Date(), oemCompanyId);
			String dateStr = DateTimeUtil.parseDateToDate(new Date());
			act.setOutData("week", dateSet != null ? dateSet.getSetWeek() : "");
			act.setOutData("yearList", yearList);
			act.setOutData("weekList", weekList);
			act.setOutData("year", year);
			act.setOutData("dateStr", dateStr);
			List<Map<String, Object>> areaBusList=MaterialGroupManagerDao.getDealerBusiness(logonUser.getPoseId().toString());
			act.setOutData("areaBusList", areaBusList);
			act.setForword(lowDlrInitUrl);
		}catch(Exception e) {//异常方法
			BizException e1 = new BizException(act,e,ErrorCodeConstant.QUERY_FAILURE_CODE,"发运指令查询初始化");
			logger.error(logonUser,e1);
			act.setException(e1);
		}
	}
	
	public void commandDown(){
		OutputStream os = null;
		AclUserBean logonUser = (AclUserBean)act.getSession().get(Constant.LOGON_USER);
		try {
			Map map=new HashMap();
			String startYear =request.getParamValue("startYear");			//订单起始年
			String endYear =request.getParamValue("endYear");				//订单结束年
			String startWeek = request.getParamValue("startWeek");			//订单起始周
			String endWeek = request.getParamValue("endWeek");				//订单结束周
			String startDate = request.getParamValue("startDate");			//发运起始时间
			String endDate = request.getParamValue("endDate");				//发运结束时间
			String orderType = request.getParamValue("orderType");			//订单类型
			String orderNo = request.getParamValue("orderNo");				//订单号码
			String transportType = request.getParamValue("transportType");	//运送方式
			String deliveryStatus = request.getParamValue("deliveryStatus");//发运状态
			String groupCode = request.getParamValue("groupCode");			//物料组CODE
			String dealerCode =request.getParamValue("dealerCode");			//经销商CODE
			String areaId = CommonUtils.checkNull(request.getParamValue("areaId"));//业务范围
			String warehouseName=CommonUtils.checkNull(request.getParamValue("endName"));//库存组织
			String erpCode =request.getParamValue("erpCode");//ERP订单号
			String billingOrgCode = CommonUtils.checkNull(request.getParamValue("billingOrgCode"));	//开票经销商
			String orderOrgCode = CommonUtils.checkNull(request.getParamValue("orderOrgCode"));		//采购经销商
			String regionId = CommonUtils.checkNull(request.getParamValue("downtown"));		// 省份
			String pageOrgId = CommonUtils.checkNull(request.getParamValue("orgId"));		// 事业部
			
			Long companyId = logonUser.getCompanyId();
			String dutyType = logonUser.getDutyType() ;
			Long orgId = logonUser.getOrgId() ;
			
			Integer curPage = request.getParamValue("curPage") !=null ? Integer.parseInt(request.getParamValue("curPage")) : 1;
			List<Map<String, Object>> areaList=MaterialGroupManagerDao.getPoseIdBusiness(logonUser.getPoseId().toString());
			String areaIds="";
			if(areaList.size()>0){
				for(int i=0;i<areaList.size();i++){
					if("".equals(areaIds)){
						areaIds = areaList.get(i).get("AREA_ID").toString();
					}else{
						areaIds = areaList.get(i).get("AREA_ID").toString()+","+areaIds;
					}
				}
				
			}
			if ("".equals(areaId)) {
				areaId = areaIds;
			}
			ResponseWrapper response = act.getResponse();
			// 导出的文件名
			String fileName = "发运指令查询.csv";
			// 导出的文字编码
			fileName = new String(fileName.getBytes("GB2312"), "ISO8859-1");
			response.setContentType("Application/text/csv");
			response.addHeader("Content-Disposition", "attachment;filename=" + fileName);
			// 定义一个集合
			List<List<Object>> list = new LinkedList<List<Object>>();
			// 标题
			List<Object> listTemp = new LinkedList<Object>();
			listTemp.add("开票方代码");
			listTemp.add("开票方名称");
			listTemp.add("采购方代码");
			listTemp.add("采购方名称");
			listTemp.add("发运单号");
			listTemp.add("发运数量");
			listTemp.add("发票号");
			listTemp.add("状态");
			listTemp.add("详细原因");
			listTemp.add("ERP订单号");
			listTemp.add("总价");
			listTemp.add("运送方式");
			listTemp.add("运送地址");
			listTemp.add("发运时间");
			list.add(listTemp);
			List<Map<String, Object>> ps = dao.getCommandQueryDown(regionId, dutyType, pageOrgId, orgId, warehouseName,billingOrgCode,orderOrgCode,startYear, startWeek, endYear, endWeek, startDate, endDate, orderType,dealerCode,orderNo, transportType, deliveryStatus, groupCode, areaId,companyId,erpCode);
			List<Map<String, Object>> rslist = ps;
			if(rslist!=null){
			for (int i = 0; i < rslist.size(); i++) {
				map = rslist.get(i);
				List<Object> listValue = new LinkedList<Object>();
				listValue = new LinkedList<Object>();
				listValue.add(map.get("CODE") != null ? map.get("CODE") : "");
				listValue.add(map.get("TTNAME") != null ? map.get("TTNAME") : "");
				listValue.add(map.get("ORDER_ORG_CODE") != null ? map.get("ORDER_ORG_CODE") : "");
				listValue.add(map.get("ORDER_ORG_NAME") != null ? map.get("ORDER_ORG_NAME") : "");
				listValue.add(map.get("DELIVERY_NO") != null ? map.get("DELIVERY_NO") : "");
				listValue.add(map.get("DELIVERY_AMOUNT") != null ? map.get("DELIVERY_AMOUNT") : "");
				listValue.add(map.get("INVOICE_NO") !=null ? map.get("INVOICE_NO"):"");
				listValue.add(map.get("CODE_DESC1") != null ? map.get("CODE_DESC1") : "");
				listValue.add(map.get("LOSE_REASON") != null ? map.get("LOSE_REASON") : "");
				listValue.add(map.get("ERP_ORDER") != null ? map.get("ERP_ORDER") : "");
				listValue.add(map.get("TOTAL_PRICE") != null ? map.get("TOTAL_PRICE") : "");
				listValue.add(map.get("CODE_DESC2") != null ? map.get("CODE_DESC2") : "");
				listValue.add(map.get("ADDRESS") != null ? map.get("ADDRESS") : "");
				listValue.add(map.get("DELIVERY_DATE") != null ? map.get("DELIVERY_DATE") : "");
				list.add(listValue);
			}
			}
			os = response.getOutputStream();
			CsvWriterUtil.writeCsv(list, os);
			os.flush();

		}catch(Exception e) {//异常方法
			BizException e1 = new BizException(act,e,ErrorCodeConstant.QUERY_FAILURE_CODE,"发运指令查询");
			logger.error(logonUser,e1);
			act.setException(e1);
		}
	}
	/**
	 * 发运指令查询
	 */
	public void commandQuery(){
		AclUserBean logonUser = (AclUserBean)act.getSession().get(Constant.LOGON_USER);
		try {
			String startYear =request.getParamValue("startYear");			//订单起始年
			String endYear =request.getParamValue("endYear");				//订单结束年
			String startWeek = request.getParamValue("startWeek");			//订单起始周
			String endWeek = request.getParamValue("endWeek");				//订单结束周
			String startDate = request.getParamValue("startDate");			//发运起始时间
			String endDate = request.getParamValue("endDate");				//发运结束时间
			String orderType = request.getParamValue("orderType");			//订单类型
			String orderNo = request.getParamValue("orderNo");				//订单号码
			String transportType = request.getParamValue("transportType");	//运送方式
			String deliveryStatus = request.getParamValue("deliveryStatus");//发运状态
			String deliveryNo = request.getParamValue("deliveryNo");
			String groupCode = request.getParamValue("groupCode");			//物料组CODE
			String dealerCode =request.getParamValue("dealerCode");			//经销商CODE
			String areaId = CommonUtils.checkNull(request.getParamValue("areaId"));//业务范围
			String warehouseName=CommonUtils.checkNull(request.getParamValue("endName"));//库存组织
			String erpCode =request.getParamValue("erpCode");//ERP订单号
			String billingOrgCode = CommonUtils.checkNull(request.getParamValue("billingOrgCode"));	//开票经销商
			String orderOrgCode = CommonUtils.checkNull(request.getParamValue("orderOrgCode"));		//采购经销商
			String regionId = CommonUtils.checkNull(request.getParamValue("downtown"));		// 省份
			String pageOrgId = CommonUtils.checkNull(request.getParamValue("orgId"));		// 事业部
			
			Long companyId = logonUser.getCompanyId();
			String dutyType = logonUser.getDutyType() ;
			Long orgId = logonUser.getOrgId() ;
			
			Integer curPage = request.getParamValue("curPage") !=null ? Integer.parseInt(request.getParamValue("curPage")) : 1;
			List<Map<String, Object>> areaList=MaterialGroupManagerDao.getPoseIdBusiness(logonUser.getPoseId().toString());
			String areaIds="";
			if(areaList.size()>0){
				for(int i=0;i<areaList.size();i++){
					if("".equals(areaIds)){
						areaIds = areaList.get(i).get("AREA_ID").toString();
					}else{
						areaIds = areaList.get(i).get("AREA_ID").toString()+","+areaIds;
					}
				}
				
			}
			if ("".equals(areaId)) {
				areaId = areaIds;
			}
			PageResult<Map<String, Object>> ps = dao.getCommandQueryList(regionId, dutyType, pageOrgId, orgId, erpCode,warehouseName,billingOrgCode,orderOrgCode,startYear, startWeek, endYear, endWeek, startDate, endDate, orderType,dealerCode,orderNo,deliveryNo, transportType, deliveryStatus, groupCode, areaId,companyId,curPage, Constant.PAGE_SIZE);
			act.setOutData("ps", ps);
		}catch(Exception e) {//异常方法
			BizException e1 = new BizException(act,e,ErrorCodeConstant.QUERY_FAILURE_CODE,"发运指令查询");
			logger.error(logonUser,e1);
			act.setException(e1);
		}
	}
	/**
	 * 发运指令查询
	 */
	public void dealerCommandQuery(){
		AclUserBean logonUser = (AclUserBean)act.getSession().get(Constant.LOGON_USER);
		try {
			String startYear =request.getParamValue("startYear");			//订单起始年
			String endYear =request.getParamValue("endYear");				//订单结束年
			String startWeek = request.getParamValue("startWeek");			//订单起始周
			String endWeek = request.getParamValue("endWeek");				//订单结束周
			String startDate = request.getParamValue("startDate");			//发运起始时间
			String endDate = request.getParamValue("endDate");				//发运结束时间
			String orderType = request.getParamValue("orderType");			//订单类型
			String orderNo = request.getParamValue("orderNo");				//订单号码
			String transportType = request.getParamValue("transportType");	//运送方式
			String deliveryStatus = request.getParamValue("deliveryStatus");//发运状态
			String groupCode = request.getParamValue("groupCode");			//物料组CODE
			String areaId = CommonUtils.checkNull(request.getParamValue("areaId"));//业务范围
			
			Long companyId = Long.parseLong(logonUser.getOemCompanyId());
			String dealerId = logonUser.getDealerId();
			Integer curPage = request.getParamValue("curPage") !=null ? Integer.parseInt(request.getParamValue("curPage")) : 1;
			List<Map<String, Object>> areaList=MaterialGroupManagerDao.getDealerBusiness(logonUser.getPoseId().toString());
			String areaIds="";
			if(areaList.size()>0){
				for(int i=0;i<areaList.size();i++){
					if("".equals(areaIds)){
						areaIds = areaList.get(i).get("AREA_ID").toString();
					}else{
						areaIds = areaList.get(i).get("AREA_ID").toString()+","+areaIds;
					}
				}
				
			}
			if ("".equals(areaId)) {
				areaId = areaIds;
			}
			PageResult<Map<String, Object>> ps = dao.getDealerCommandQueryList(dealerId,startYear, startWeek, endYear, endWeek, startDate, endDate, orderType,orderNo, transportType, deliveryStatus, groupCode, areaId,companyId,curPage, Constant.PAGE_SIZE);
			act.setOutData("ps", ps);
		}catch(Exception e) {//异常方法
			BizException e1 = new BizException(act,e,ErrorCodeConstant.QUERY_FAILURE_CODE,"发运指令查询");
			logger.error(logonUser,e1);
			act.setException(e1);
		}
	}
	
	/**
	 * 发运指令查询
	 */
	public void lowDlrCommandQuery(){
		AclUserBean logonUser = (AclUserBean)act.getSession().get(Constant.LOGON_USER);
		try {
			String startYear =request.getParamValue("startYear");			//订单起始年
			String endYear =request.getParamValue("endYear");				//订单结束年
			String startWeek = request.getParamValue("startWeek");			//订单起始周
			String endWeek = request.getParamValue("endWeek");				//订单结束周
			String startDate = request.getParamValue("startDate");			//发运起始时间
			String endDate = request.getParamValue("endDate");				//发运结束时间
			String orderType = request.getParamValue("orderType");			//订单类型
			String orderNo = request.getParamValue("orderNo");				//订单号码
			String transportType = request.getParamValue("transportType");	//运送方式
			String deliveryStatus = request.getParamValue("deliveryStatus");//发运状态
			String groupCode = request.getParamValue("groupCode");			//物料组CODE
			String areaId = CommonUtils.checkNull(request.getParamValue("areaId"));//业务范围
			
			Long companyId = Long.parseLong(logonUser.getOemCompanyId());
			String dealerId = logonUser.getDealerId();
			dealerId = OrderQueryDao.getInstance().getDlr(dealerId, Constant.DEALER_LEVEL_02.toString()) ;
			
			Integer curPage = request.getParamValue("curPage") !=null ? Integer.parseInt(request.getParamValue("curPage")) : 1;
			List<Map<String, Object>> areaList=MaterialGroupManagerDao.getDealerBusiness(logonUser.getPoseId().toString());
			String areaIds="";
			if(areaList.size()>0){
				for(int i=0;i<areaList.size();i++){
					if("".equals(areaIds)){
						areaIds = areaList.get(i).get("AREA_ID").toString();
					}else{
						areaIds = areaList.get(i).get("AREA_ID").toString()+","+areaIds;
					}
				}
				
			}
			if ("".equals(areaId)) {
				areaId = areaIds;
			}
			PageResult<Map<String, Object>> ps = dao.getLowDlrCommandQueryList(dealerId,startYear, startWeek, endYear, endWeek, startDate, endDate, orderType,orderNo, transportType, deliveryStatus, groupCode, areaId,companyId,curPage, Constant.PAGE_SIZE);
			act.setOutData("ps", ps);
		}catch(Exception e) {//异常方法
			BizException e1 = new BizException(act,e,ErrorCodeConstant.QUERY_FAILURE_CODE,"发运指令查询");
			logger.error(logonUser,e1);
			act.setException(e1);
		}
	}
	
	/**
	 * 发运指令下载
	 */
	public void dealerCommandQueryLoad(){
		AclUserBean logonUser = (AclUserBean)act.getSession().get(Constant.LOGON_USER);
		OutputStream os = null;
		try {
			String startYear =request.getParamValue("startYear");			//订单起始年
			String endYear =request.getParamValue("endYear");				//订单结束年
			String startWeek = request.getParamValue("startWeek");			//订单起始周
			String endWeek = request.getParamValue("endWeek");				//订单结束周
			String startDate = request.getParamValue("startDate");			//发运起始时间
			String endDate = request.getParamValue("endDate");				//发运结束时间
			String orderType = request.getParamValue("orderType");			//订单类型
			String orderNo = request.getParamValue("orderNo");				//订单号码
			String transportType = request.getParamValue("transportType");	//运送方式
			String deliveryStatus = request.getParamValue("deliveryStatus");//发运状态
			String groupCode = request.getParamValue("groupCode");			//物料组CODE
			String areaId = CommonUtils.checkNull(request.getParamValue("areaId"));//业务范围
			
			Long companyId = Long.parseLong(logonUser.getOemCompanyId());
			String dealerId = logonUser.getDealerId();
			Integer curPage = request.getParamValue("curPage") !=null ? Integer.parseInt(request.getParamValue("curPage")) : 1;
			List<Map<String, Object>> areaList=MaterialGroupManagerDao.getDealerBusiness(logonUser.getPoseId().toString());
			String areaIds="";
			if(areaList.size()>0){
				for(int i=0;i<areaList.size();i++){
					if("".equals(areaIds)){
						areaIds = areaList.get(i).get("AREA_ID").toString();
					}else{
						areaIds = areaList.get(i).get("AREA_ID").toString()+","+areaIds;
					}
				}
			}
			if ("".equals(areaId)) {
				areaId = areaIds;
			}
			Map<String, Object> map = new HashMap<String, Object>();
			// 导出的文件名
			String fileName = "发运指令.csv";
			// 导出的文字编码
			fileName = new String(fileName.getBytes("GB2312"), "ISO8859-1");
			response.setContentType("Application/text/csv");
			response.addHeader("Content-Disposition", "attachment;filename="
					+ fileName);

			List<List<Object>> list = new LinkedList<List<Object>>();

			List<Object> listTemp = new LinkedList<Object>();
			listTemp.add("开票方代码");
			listTemp.add("开票方名称");
			listTemp.add("采购方代码");
			listTemp.add("采购方名称");
			listTemp.add("订单号码");
			listTemp.add("发运单号");
			listTemp.add("发运数量");
			listTemp.add("发票号");
			listTemp.add("状态");
			listTemp.add("失败原因");
			listTemp.add("ERP订单号");
			listTemp.add("总价");
			listTemp.add("运送方式");
			listTemp.add("运送地址");
			listTemp.add("发运时间");
			list.add(listTemp);

			List<Map<String, Object>> results = dao.getDealerCommandQueryListLoad(dealerId,startYear, startWeek, endYear, endWeek, startDate, endDate, orderType,orderNo, transportType, deliveryStatus, groupCode, areaId,companyId,curPage, Constant.PAGE_SIZE);
			for (int i = 0; i < results.size(); i++) {
				Map<String, Object> record = results.get(i);
				listTemp = new LinkedList<Object>();
				listTemp.add(CommonUtils.checkNull(record.get("CODE")));
				listTemp.add(CommonUtils.checkNull(record.get("TTNAME")));
				listTemp.add(CommonUtils.checkNull(record.get("ORDER_ORG_CODE")));
				listTemp.add(CommonUtils.checkNull(record.get("ORDER_ORG_NAME")));
				listTemp.add(CommonUtils.checkNull(record.get("ORDER_NO")));
				listTemp.add(CommonUtils.checkNull(record.get("DELIVERY_NO")));
				listTemp.add(CommonUtils.checkNull(record.get("DELIVERY_AMOUNT")));
				listTemp.add(CommonUtils.checkNull(record.get("INVOICE_NO")));
				listTemp.add(CommonUtils.checkNull(record.get("DELIVERY_STATUS")));
				listTemp.add(CommonUtils.checkNull(record.get("LOSE_REASON")));
				listTemp.add(CommonUtils.checkNull(record.get("ERP_ORDER")));
				listTemp.add(CommonUtils.checkNull(record.get("TOTAL_PRICE")));
				listTemp.add(CommonUtils.checkNull(record.get("DELIVERY_TYPE")));
				listTemp.add(CommonUtils.checkNull(record.get("ADDRESS")));
				listTemp.add(CommonUtils.checkNull(record.get("DELIVERY_DATE")));
				list.add(listTemp);
			}
			os = response.getOutputStream();
			CsvWriterUtil.writeCsv(list, os);
			os.flush();
			
			
		}catch(Exception e) {//异常方法
			BizException e1 = new BizException(act,e,ErrorCodeConstant.QUERY_FAILURE_CODE,"发运指令查询");
			logger.error(logonUser,e1);
			act.setException(e1);
		}
	}
	
	/**
	 * 下级经销商发运指令下载
	 */
	public void lowDlrCommandQueryLoad(){
		AclUserBean logonUser = (AclUserBean)act.getSession().get(Constant.LOGON_USER);
		OutputStream os = null;
		try {
			String startYear =request.getParamValue("startYear");			//订单起始年
			String endYear =request.getParamValue("endYear");				//订单结束年
			String startWeek = request.getParamValue("startWeek");			//订单起始周
			String endWeek = request.getParamValue("endWeek");				//订单结束周
			String startDate = request.getParamValue("startDate");			//发运起始时间
			String endDate = request.getParamValue("endDate");				//发运结束时间
			String orderType = request.getParamValue("orderType");			//订单类型
			String orderNo = request.getParamValue("orderNo");				//订单号码
			String transportType = request.getParamValue("transportType");	//运送方式
			String deliveryStatus = request.getParamValue("deliveryStatus");//发运状态
			String groupCode = request.getParamValue("groupCode");			//物料组CODE
			String areaId = CommonUtils.checkNull(request.getParamValue("areaId"));//业务范围
			
			Long companyId = Long.parseLong(logonUser.getOemCompanyId());
			String dealerId = logonUser.getDealerId();
			dealerId = OrderQueryDao.getInstance().getDlr(dealerId, Constant.DEALER_LEVEL_02.toString()) ;
			
			Integer curPage = request.getParamValue("curPage") !=null ? Integer.parseInt(request.getParamValue("curPage")) : 1;
			List<Map<String, Object>> areaList=MaterialGroupManagerDao.getDealerBusiness(logonUser.getPoseId().toString());
			String areaIds="";
			if(areaList.size()>0){
				for(int i=0;i<areaList.size();i++){
					if("".equals(areaIds)){
						areaIds = areaList.get(i).get("AREA_ID").toString();
					}else{
						areaIds = areaList.get(i).get("AREA_ID").toString()+","+areaIds;
					}
				}
			}
			if ("".equals(areaId)) {
				areaId = areaIds;
			}
			Map<String, Object> map = new HashMap<String, Object>();
			// 导出的文件名
			String fileName = "发运指令.csv";
			// 导出的文字编码
			fileName = new String(fileName.getBytes("GB2312"), "ISO8859-1");
			response.setContentType("Application/text/csv");
			response.addHeader("Content-Disposition", "attachment;filename="
					+ fileName);

			List<List<Object>> list = new LinkedList<List<Object>>();

			List<Object> listTemp = new LinkedList<Object>();
			listTemp.add("开票方代码");
			listTemp.add("开票方名称");
			listTemp.add("采购方代码");
			listTemp.add("采购方名称");
			listTemp.add("发运单号");
			listTemp.add("发运数量");
			listTemp.add("发票号");
			listTemp.add("状态");
			listTemp.add("失败原因");
			listTemp.add("ERP订单号");
			listTemp.add("运送方式");
			listTemp.add("运送地址");
			listTemp.add("发运时间");
			list.add(listTemp);

			List<Map<String, Object>> results = dao.getLowDlrCommandQueryListLoad(dealerId,startYear, startWeek, endYear, endWeek, startDate, endDate, orderType,orderNo, transportType, deliveryStatus, groupCode, areaId,companyId,curPage, Constant.PAGE_SIZE);
			for (int i = 0; i < results.size(); i++) {
				Map<String, Object> record = results.get(i);
				listTemp = new LinkedList<Object>();
				listTemp.add(CommonUtils.checkNull(record.get("CODE")));
				listTemp.add(CommonUtils.checkNull(record.get("TTNAME")));
				listTemp.add(CommonUtils.checkNull(record.get("ORDER_ORG_CODE")));
				listTemp.add(CommonUtils.checkNull(record.get("ORDER_ORG_NAME")));
				listTemp.add(CommonUtils.checkNull(record.get("DELIVERY_NO")));
				listTemp.add(CommonUtils.checkNull(record.get("DELIVERY_AMOUNT")));
				listTemp.add(CommonUtils.checkNull(record.get("INVOICE_NO")));
				listTemp.add(CommonUtils.checkNull(record.get("DELIVERY_STATUS")));
				listTemp.add(CommonUtils.checkNull(record.get("LOSE_REASON")));
				listTemp.add(CommonUtils.checkNull(record.get("ERP_ORDER")));
				listTemp.add(CommonUtils.checkNull(record.get("DELIVERY_TYPE")));
				listTemp.add(CommonUtils.checkNull(record.get("ADDRESS")));
				listTemp.add(CommonUtils.checkNull(record.get("DELIVERY_DATE")));
				list.add(listTemp);
			}
			os = response.getOutputStream();
			CsvWriterUtil.writeCsv(list, os);
			os.flush();
			
			
		}catch(Exception e) {//异常方法
			BizException e1 = new BizException(act,e,ErrorCodeConstant.QUERY_FAILURE_CODE,"发运指令查询");
			logger.error(logonUser,e1);
			act.setException(e1);
		}
	}
	
	public void getMyPiao(){
		
		AclUserBean logonUser = (AclUserBean)act.getSession().get(Constant.LOGON_USER);
		String deliverNo=request.getParamValue("deliverId");
		
		String sql="SELECT * FROM TT_VS_DLVRY_DTL_INVOICE TVDDI WHERE TVDDI.ORDER_NO='"+deliverNo+"'";
		//String sql="SELECT * FROM XXDMS_ORDER_REASON_RETURN XORR WHERE XORR.DMS_ORDER_NUMBER='"+deliverId+"'";
		List<Map<String, Object>> list=dao.pageQuery(sql,null, getFunName());
		act.setOutData("deliverNo", deliverNo);
		act.setOutData("ticketMap", list);
		act.setForword(myticket);
	}
	public void getMyReson(){
		
		AclUserBean logonUser = (AclUserBean)act.getSession().get(Constant.LOGON_USER);
		String deliverId=request.getParamValue("deliverId");
		
		String sql="SELECT * FROM TT_VS_DLVRY TVD WHERE TVD.DELIVERY_NO='"+deliverId+"'";
		//String sql="SELECT * FROM XXDMS_ORDER_REASON_RETURN XORR WHERE XORR.DMS_ORDER_NUMBER='"+deliverId+"'";
		List<Map<String, Object>> list=dao.pageQuery(sql,null, getFunName());
		act.setOutData("deliverNo", deliverId);
		act.setOutData("resonsMap", list);
		act.setForword(myreson);
	}
	
	public void commandQueryInfo(){
		AclUserBean logonUser = (AclUserBean)act.getSession().get(Constant.LOGON_USER);
		try {
			String reqId = request.getParamValue("reqId");
			String orderType = request.getParamValue("orderType");
			Long companyId = GetOemcompanyId.getOemCompanyId(logonUser);
			Map<String, Object> map = dao.getdeliveryInfoMap(reqId);
			
			String areaGet = ((BigDecimal) map.get("AREA_ID")).toString();
			TmBusinessAreaPO areaPO = new TmBusinessAreaPO();
			areaPO.setAreaId(new Long(areaGet));
			List<PO> areaList = dao.select(areaPO);
			Long erpCode = null;
			if(areaList.size() != 0){
				areaPO = (TmBusinessAreaPO)areaList.get(0);
				erpCode = areaPO.getErpCode();
			}
			
			List<Map<String, Object>> list = dao.getorderResourceReserveDetailList(reqId,orderType,String.valueOf(companyId), erpCode.toString());
			BigDecimal dealerId = (BigDecimal)map.get("BILLING_ORG_ID");
			List<Map<String,Object>> discountList = accoutDao.getDiscountAccountInfoByDealerId(dealerId.toString());
			act.setOutData("map", map);
			act.setOutData("list", list);
			act.setOutData("discountList", discountList);
			act.setForword(qinfoUrl);
		}catch(Exception e) {//异常方法
			BizException e1 = new BizException(act,e,ErrorCodeConstant.QUERY_FAILURE_CODE,"经销商确认明细");
			logger.error(logonUser,e1);
			act.setException(e1);
		}
	}
	
	public void lowCommandQueryInfo(){
		AclUserBean logonUser = (AclUserBean)act.getSession().get(Constant.LOGON_USER);
		try {
			String reqId = request.getParamValue("reqId");
			String orderType = request.getParamValue("orderType");
			Long companyId = GetOemcompanyId.getOemCompanyId(logonUser);
			Map<String, Object> map = dao.getdeliveryInfoMap(reqId);
			
			String areaGet = ((BigDecimal) map.get("AREA_ID")).toString();
			TmBusinessAreaPO areaPO = new TmBusinessAreaPO();
			areaPO.setAreaId(new Long(areaGet));
			List<PO> areaList = dao.select(areaPO);
			Long erpCode = null;
			if(areaList.size() != 0){
				areaPO = (TmBusinessAreaPO)areaList.get(0);
				erpCode = areaPO.getErpCode();
			}
			
			List<Map<String, Object>> list = dao.getorderResourceReserveDetailList(reqId,orderType,String.valueOf(companyId), erpCode.toString());
			BigDecimal dealerId = (BigDecimal)map.get("BILLING_ORG_ID");
			List<Map<String,Object>> discountList = accoutDao.getDiscountAccountInfoByDealerId(dealerId.toString());
			act.setOutData("map", map);
			act.setOutData("list", list);
			act.setOutData("discountList", discountList);
			act.setForword(lowQinfoUrl);
		}catch(Exception e) {//异常方法
			BizException e1 = new BizException(act,e,ErrorCodeConstant.QUERY_FAILURE_CODE,"经销商确认明细");
			logger.error(logonUser,e1);
			act.setException(e1);
		}
	}
	
	public void commandQuery22222Print(){
		AclUserBean logonUser = (AclUserBean)act.getSession().get(Constant.LOGON_USER);
		try {
			String reqId = request.getParamValue("reqId");
			String orderType = request.getParamValue("orderType");
			Long companyId = GetOemcompanyId.getOemCompanyId(logonUser);
			Map<String, Object> map = dao.getdeliveryInfoMap(reqId);
			
			String areaGet = ((BigDecimal) map.get("AREA_ID")).toString();
			TmBusinessAreaPO areaPO = new TmBusinessAreaPO();
			areaPO.setAreaId(new Long(areaGet));
			List<PO> areaList = dao.select(areaPO);
			Long erpCode = null;
			if(areaList.size() != 0){
				areaPO = (TmBusinessAreaPO)areaList.get(0);
				erpCode = areaPO.getErpCode();
			}
			
			List<Map<String, Object>> list = dao.getorderResourceReserveDetailList(reqId,orderType,String.valueOf(companyId),erpCode.toString());
			act.setOutData("map", map);
			act.setOutData("list", list);
			act.setForword(printUrl);
		}catch(Exception e) {//异常方法
			BizException e1 = new BizException(act,e,ErrorCodeConstant.QUERY_FAILURE_CODE,"经销商确认明细");
			logger.error(logonUser,e1);
			act.setException(e1);
		}
	}
	
	/*
	 * 发运指令打印初始化
	 */
	public void commandPintInit(){
		AclUserBean logonUser = (AclUserBean)act.getSession().get(Constant.LOGON_USER);
		try {
			Long companyId = GetOemcompanyId.getOemCompanyId(logonUser);
			//Long orgId = logonUser.getOrgId() ;
			Long poseId = logonUser.getPoseId() ;
			List<Map<String, Object>> list = dao.getOrgList(companyId);//取得大区信息
			//List<Map<String, Object>> listA = dao.getAreaList(orgId);//获取业务范围
			List<Map<String, Object>> listA = dao.getAreaList(poseId);//获取业务范围
			act.setOutData("list", list);
			act.setOutData("listA", listA) ;
			act.setForword(printInitUrl);
		}catch(Exception e) {//异常方法
			BizException e1 = new BizException(act,e,ErrorCodeConstant.QUERY_FAILURE_CODE,"发运指令打印初始化");
			logger.error(logonUser,e1);
			act.setException(e1);
		}
	}
	
	/*
	 * 发运指令打印
	 */
	public void commandQueryPrint(){
		AclUserBean logonUser = (AclUserBean)act.getSession().get(Constant.LOGON_USER);
		try {
			String deliveryNo = CommonUtils.checkNull(request.getParamValue("deliveryNo"));//发运单号
			String printFlag = CommonUtils.checkNull(request.getParamValue("printFlag"));//打印状态
			String startDate = request.getParamValue("startDate");			//发运起始时间
			String endDate = request.getParamValue("endDate");				//发运结束时间
			String orgId = CommonUtils.checkNull(request.getParamValue("orgId"));//大区
			String areaId =  CommonUtils.checkNull(request.getParamValue("areaId"));//业务范围
			Long companyId = logonUser.getCompanyId();
			String dutyType = logonUser.getDutyType() ;
			
			if(Constant.DUTY_TYPE_LARGEREGION.toString().equals(dutyType)) {
				orgId = logonUser.getOrgId().toString() ;
			}
			
			StringBuffer areaIds = new StringBuffer();
			List<Map<String, Object>> areaBusList=MaterialGroupManagerDao.getPoseIdBusiness(logonUser.getPoseId().toString());
			for (int i = 0; i < areaBusList.size(); i++) {
				if (!"".equals(String.valueOf(areaBusList.get(i).get("AREA_ID")))) {
					areaIds.append(String.valueOf(areaBusList.get(i).get("AREA_ID")));
				}
				if (i<areaBusList.size()-1) {
					areaIds.append(",");
				}
			}
			Integer curPage = request.getParamValue("curPage") !=null ? Integer.parseInt(request.getParamValue("curPage")) : 1;
			PageResult<Map<String, Object>> ps = dao.getCommandPrintList(areaIds.toString(), areaId, orgId, startDate, endDate, deliveryNo,printFlag, companyId,curPage, Constant.PAGE_SIZE);
			act.setOutData("ps", ps);
		}catch(Exception e) {//异常方法
			BizException e1 = new BizException(act,e,ErrorCodeConstant.QUERY_FAILURE_CODE,"发运指令查询");
			logger.error(logonUser,e1);
			act.setException(e1);
		}
	}
	
	/*
	 * 打印预览内容
	 */
	public void commandPrintInfo(){
		AclUserBean logonUser = (AclUserBean)act.getSession().get(Constant.LOGON_USER);
		try {
			String reqId = CommonUtils.checkNull(request.getParamValue("reqId"));//发运ID
			String orderType = CommonUtils.checkNull(request.getParamValue("orderType"));//订单类型
			Long companyId = GetOemcompanyId.getOemCompanyId(logonUser);
			Map<String, Object> map = dao.getdeliveryInfoMap(reqId);
			
			String areaGet = ((BigDecimal) map.get("AREA_ID")).toString();
			TmBusinessAreaPO areaPO = new TmBusinessAreaPO();
			areaPO.setAreaId(new Long(areaGet));
			List<PO> areaList = dao.select(areaPO);
			Long erpCode = null;
			if(areaList.size() != 0){
				areaPO = (TmBusinessAreaPO)areaList.get(0);
				erpCode = areaPO.getErpCode();
			}
			
			List<Map<String, Object>> list = dao.getorderResourceReserveDetailList(reqId,orderType,String.valueOf(companyId),erpCode.toString());
			act.setOutData("map", map);
			act.setOutData("list", list);
			act.setForword(printNewUrl);
		}catch(Exception e) {//异常方法
			BizException e1 = new BizException(act,e,ErrorCodeConstant.QUERY_FAILURE_CODE,"发运指令打印内容");
			logger.error(logonUser,e1);
			act.setException(e1);
		}
	}
	
	/*
	 * 打印完成
	 */
	public void commandPrintOver(){
		AclUserBean logonUser = (AclUserBean)act.getSession().get(Constant.LOGON_USER);
		try {
			String[] deliveryIds = request.getParamValues("deliveryIds");
			
			if(deliveryIds!=null&&deliveryIds.length>0){
				for(int i=0;i<deliveryIds.length;i++){
					TtVsDlvryPO po = new TtVsDlvryPO();
					TtVsDlvryPO tp = new TtVsDlvryPO();
					po.setDeliveryId(Long.parseLong(deliveryIds[i]));
					tp.setPrintFlag(Integer.parseInt(Constant.PRINT_FLAG_01));
					tp.setUpdateBy(logonUser.getUserId());
					tp.setUpdateDate(new Date());
					dao.update(po, tp);
				}
			}
			
			act.setOutData("returnValue", 1);
		}catch(Exception e) {//异常方法
			BizException e1 = new BizException(act,e,ErrorCodeConstant.SPECIAL_MEG,"");
			logger.error(logonUser,e1);
			act.setException(e1);
		}
	}
	
	/*
	 * 在途车辆查询
	 */
	public void passageQueryInit(){
		AclUserBean logonUser = (AclUserBean)act.getSession().get(Constant.LOGON_USER);
		try {
			List<Map<String, Object>> areaBusList=MaterialGroupManagerDao.getPoseIdBusiness(logonUser.getPoseId().toString());
			
			Long orgId = logonUser.getOrgId() ;
			String dutyType = logonUser.getDutyType() ;
			
			List<Map<String, Object>> orgList = dao.getOemOrg(dutyType, orgId) ;
			
			act.setOutData("orgList", orgList) ;
			act.setOutData("areaBusList", areaBusList);
			act.setForword(passageUrl);
		}catch(Exception e) {//异常方法
			BizException e1 = new BizException(act,e,ErrorCodeConstant.QUERY_FAILURE_CODE,"在途车辆查询初始化");
			logger.error(logonUser,e1);
			act.setException(e1);
		}
	}
	
	public void dealerPassageQueryInit(){
		AclUserBean logonUser = (AclUserBean)act.getSession().get(Constant.LOGON_USER);
		try {
			List<Map<String, Object>> areaBusList=MaterialGroupManagerDao.getDealerBusiness(logonUser.getPoseId().toString());
			act.setOutData("areaBusList", areaBusList);
			act.setForword(dealerPassageUrl);
		}catch(Exception e) {//异常方法
			BizException e1 = new BizException(act,e,ErrorCodeConstant.QUERY_FAILURE_CODE,"在途车辆查询初始化");
			logger.error(logonUser,e1);
			act.setException(e1);
		}
	}
	
	public void passageQuery(){
		AclUserBean logonUser = (AclUserBean)act.getSession().get(Constant.LOGON_USER);
		try {
			String dealerCode = CommonUtils.checkNull(request.getParamValue("dealerCode"));
			String sendcarNo = request.getParamValue("sendcarNo");
			String erpNo = request.getParamValue("erpNo");
			String areaId = CommonUtils.checkNull(request.getParamValue("areaId"));
			String regionId = CommonUtils.checkNull(request.getParamValue("downtown"));		// 省份
			String pageOrgId = CommonUtils.checkNull(request.getParamValue("orgId"));		// 事业部
			String deliveryNo = CommonUtils.checkNull(request.getParamValue("deliveryNo")) ;	// 发运单号
			String dutyType = logonUser.getDutyType() ;
			Long orgId = logonUser.getOrgId() ;
			StringBuffer areaIds = new StringBuffer();
			List<Map<String, Object>> areaBusList=MaterialGroupManagerDao.getPoseIdBusiness(logonUser.getPoseId().toString());
			for (int i = 0; i < areaBusList.size(); i++) {
				if (!"".equals(String.valueOf(areaBusList.get(i).get("AREA_ID")))) {
					areaIds.append(String.valueOf(areaBusList.get(i).get("AREA_ID")));
				}
				if (i<areaBusList.size()-1) {
					areaIds.append(",");
				}
			}
			if(!dealerCode.equals("")){//截串加单引号
				String[] supp = dealerCode.split(",");
				dealerCode = "";
				for(int i=0;i<supp.length;i++){
					supp[i] = "'"+supp[i]+"'";
					if(!dealerCode.equals("")){
						dealerCode += "," + supp[i];
					}else{
						dealerCode = supp[i];
					}
				}
			}
			Integer curPage = request.getParamValue("curPage") !=null ? Integer.parseInt(request.getParamValue("curPage")) : 1;
			PageResult<Map<String, Object>> ps = dao.getPassageQuery(deliveryNo, areaIds.toString(),areaId,dealerCode,sendcarNo, erpNo,regionId,pageOrgId,dutyType,orgId, curPage, Constant.PAGE_SIZE);
			act.setOutData("ps", ps);
		}catch(Exception e) {//异常方法
			BizException e1 = new BizException(act,e,ErrorCodeConstant.QUERY_FAILURE_CODE,"发运指令查询");
			logger.error(logonUser,e1);
			act.setException(e1);
		}
	}
	
	public void dealerPassageQuery(){
		AclUserBean logonUser = (AclUserBean)act.getSession().get(Constant.LOGON_USER);
		try {
			String dealerId = logonUser.getDealerId();
			String sendcarNo = request.getParamValue("sendcarNo");
			String erpNo = request.getParamValue("erpNo");
			String areaId = CommonUtils.checkNull(request.getParamValue("areaId"));
			StringBuffer areaIds = new StringBuffer();
			List<Map<String, Object>> areaBusList=MaterialGroupManagerDao.getPoseIdBusiness(logonUser.getPoseId().toString());
			for (int i = 0; i < areaBusList.size(); i++) {
				if (!"".equals(String.valueOf(areaBusList.get(i).get("AREA_ID")))) {
					areaIds.append(String.valueOf(areaBusList.get(i).get("AREA_ID")));
				}
				if (i<areaBusList.size()-1) {
					areaIds.append(",");
				}
			}
			Integer curPage = request.getParamValue("curPage") !=null ? Integer.parseInt(request.getParamValue("curPage")) : 1;
			PageResult<Map<String, Object>> ps = dao.getDealerPassageQuery(areaIds.toString(),areaId, dealerId,sendcarNo, erpNo, curPage, Constant.PAGE_SIZE);
			act.setOutData("ps", ps);
		}catch(Exception e) {//异常方法
			BizException e1 = new BizException(act,e,ErrorCodeConstant.QUERY_FAILURE_CODE,"发运指令查询");
			logger.error(logonUser,e1);
			act.setException(e1);
		}
	}
	
	public String getFunName() {
		StackTraceElement stack[] = new Throwable().getStackTrace(); 
		StackTraceElement ste = stack[1];   
		//System.out.println(ste.getClassName() + "." + ste.getMethodName() + ste.getLineNumber()); 
		StringBuilder strBuilder = new StringBuilder();
		return strBuilder.append(ste.getClassName()).
			append(".").append(ste.getMethodName()).
			append(ste.getLineNumber()).
			toString();  
	}
	
	/**
	 * 展示送车单车辆
	 * add by yx 20110113
	 */
	public void showSendCarsDetail(){
		AclUserBean logonUser = (AclUserBean)act.getSession().get(Constant.LOGON_USER);
		try {
			String COMMAND = CommonUtils.checkNull(request.getParamValue("COMMAND"));
			String sendCarNo = request.getParamValue("sendCarNo");
			if(!"".equals(COMMAND)){
				String dealerId = logonUser.getDealerId();
				
				Integer curPage = request.getParamValue("curPage") !=null ? Integer.parseInt(request.getParamValue("curPage")) : 1;
				PageResult<Map<String, Object>> ps = dao.getSendCarsDetail(sendCarNo, curPage, Constant.PAGE_SIZE);
				act.setOutData("ps", ps);
			}else{
				act.setOutData("sendCarNo", sendCarNo);
				act.setForword(showSendCarsDetail);
			}

		}catch(Exception e) {//异常方法
			BizException e1 = new BizException(act,e,ErrorCodeConstant.QUERY_FAILURE_CODE,"发运指令查询");
			logger.error(logonUser,e1);
			act.setException(e1);
		}
	}
	
}
